package org.grow.demo.controller;

import org.grow.demo.dao.GoodsJpa;
import org.grow.demo.entity.Goods;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class GoodsController {

    @Autowired
    private GoodsJpa goodsJpa;
    @PostMapping("/goods")
    public Goods insertGoods(@RequestBody Goods goods){
        goods.setGoodsId(0);
        Goods saved = goodsJpa.save(goods);
        return saved;
    }
}
